﻿using Cap;
using Cap.Testing;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using System.Text;

var builder = Host.CreateDefaultBuilder(args);
builder.ConfigureServices(services =>
{
    services.AddCap(configure =>
    {
        configure.AddCapStrategy<MyCapStrategy>();
        configure.AddEventSource<RabbtEventSource>("order", c => { });
        configure.UseEndpoints(endpoints =>
        {
            endpoints.Run(context =>
            {
                var message = Encoding.UTF8.GetString(context.Body);
                Console.WriteLine(message);
                return Task.CompletedTask;
            });
        });
    });
});
var host = builder.Build();
await host.RunAsync();